package com.jml.分布式session一致性.token代替session;

import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TokenService {

	@Autowired
	private RedisService redisService;

	// 新增 返回token
	public String put(Object object) {
		String token = getToken();
		redisService.setString(token, object);
		return token;
	}

	// 获取信息
	public String get(String token) {
		String reuslt = redisService.getString(token);
		return reuslt;
	}

	public String getToken() {
		return UUID.randomUUID().toString();
	}
}

